var isLateralNavAnimating = false;
//o打开或关闭导航菜单
$('.menu').on('click', function(event) {
    event.preventDefault();
    //若动画正在进行，则停止
    if (!isLateralNavAnimating) {
        if ($(this).parents('.csstransitions').length > 0)
            isLateralNavAnimating = true;

        $('body').toggleClass('navigation-is-open');
        $('.drop-nav').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() {
            //动画结束
            isLateralNavAnimating = false;
        });
    }
});

$.fn.smartFloat = function() {
    var position = function(element) {
        var top = element.parent().next().position().top, pos = element.css("position");
        $(window).scroll(function() {
            var scrolls = $(this).scrollTop();
            if (scrolls > top) {
                element.css({
                    position: "fixed",
                    top: 0,
                    display:"block"
                }).addClass("shadow");
            }else {
                element.css({
                    position: pos,
                    top: top,
                    display:"none"
                }).removeClass("shadow");
            }
        });
    };
    return $(this).each(function() {
        position($(this));
    });
};

/*==============================
*  弹窗：
*  问号说明
*/
/** Add Start by Kevin 2018/07/13 Optimize order input page for PC and WAP */
var v2doubtIndex;
/** Add End by Kevin 2018/07/13 Optimize order input page for PC and WAP */
$(document).on('click', 'a.doubt', function ()
{
    /** Add Start by Kevin 2018/07/13 Optimize order input page for PC and WAP */
    v2doubtIndex = layer.open({
    /** Add End by Kevin 2018/07/13 Optimize order input page for PC and WAP */
        title: [
            $(this).attr('data-title'),
            'background-color:#f1f9ff;font-weight:bold;'
        ]
        , content: '<a href="javascript:;" class="close">&nbsp;</a><p class="tip_doubt">' + $(this).attr('data-tip') + '</p>'
    });
})



$(document).on('click', '.product-nav ul li a', function ()
{
    $('.product-nav ul li a').removeClass('product-nav-thiss');
    $(this).addClass('product-nav-thiss');
    $('.product-box .product-cont').hide();
    $('.product-box .product-cont:eq(' + $(this).parent().index() + ')').show();
})

$(document).on('click', '.ensure-item table th a', function ()
{
    $(this).toggleClass('show');
    $(this).parents('thead').next('tbody').toggle();
    $(this).parents('table').siblings().find('tbody').hide();
    $(this).parents('table').siblings().find('th>a').removeClass('show');
})